#include <iostream>
using namespace std;
#include <ctime>

struct Student
{
  string name; // 姓名
  int score;   // 分数
};

struct Teacher
{
  string name;        // 姓名
  Student stuList[5]; // 所带学生
};

void allocateSpace(Teacher teachers[], int len)
{
  string nameSeed = "ABCDE";
  for (int i = 0; i < len; i++)
  {
    teachers[i].name = "Teacher_";
    teachers[i].name += nameSeed[i];

    for(int j = 0; j < 5; j++)
    {
      teachers[i].stuList[j].name = "Student_";
      teachers[i].stuList[j].name += nameSeed[j];

      int random = rand() % 61 + 40; // 40 ~ 100
      teachers[i].stuList[j].score = random;
    }
  }
}

void printInfo(struct Teacher teachers[], int len)
{
  for (int i = 0; i < len; i++)
  {
    cout << "老师姓名：" << teachers[i].name << endl;

    for (int j = 0; j < 5; j++)
    {
      cout << "\t学生姓名：" << teachers[i].stuList[j].name << "\t学生分数：" << teachers[i].stuList[j].score << endl;
    }
  }
}

int main()
{
  // 随机数种子
  srand((unsigned int)time(NULL));
  // 1.创建三名老师的数组
  struct Teacher teacherList[3];

  // 2.通过函数给三名老师的信息赋值，并给老师带的学生信息赋值
  int len = sizeof(teacherList) / sizeof(teacherList[0]);
  allocateSpace(teacherList, len);
  // 3.打印所有老师所带学生信息
  printInfo(teacherList, len);

  return 0;
}